﻿#ifndef __AVOID_CONTROL_HEAD_FILE_HANDLE_INCLUDED__
#define __AVOID_CONTROL_HEAD_FILE_HANDLE_INCLUDED__
#include "control.h"
#include "ctlText.h"
#include "interface/IUserDraw.h"
#include "interface/IFont.h"

namespace swui
{
	enum class ctlTriangleDirection : unsigned {
			left, top, right, bottom
	};
	/* 在有 IUserDraw 接口的控件上绘制一个三角形
	 * 可用事件 ctlNotifyEventType::draw  */
	ctlRoot::lamNotifyEvent createTriangleButtonHandle(
		ctlTriangleDirection direction,		//决定三角形指向的方向
		float widthPercent, float heightPercent,
		ctlColor triangleFillColor32,		//这个值是 32 位的颜色，用于填充背景
		ctlColor triangleBorderColor32,		//这个值是 32 位的颜色，用于绘制边框
		decltype(ctlNotifyUserDraw::state) state = ctlNotifyUserDraw::background);

	ctlRoot::lamNotifyEvent createTriangleButtonHandle(
		ctlTriangleDirection direction,		//决定三角形指向的方向
		float widthPercent, float heightPercent,
		ctlColor triangleColor32,		//这个值是 32 位的颜色，用于填充背景
		decltype(ctlNotifyUserDraw::state) state = ctlNotifyUserDraw::background);
	
	ctlRoot::lamNotifyEvent createTriangleButtonHandle(
		ctlTriangleDirection direction,		//决定三角形指向的方向
		float widthPercent, float heightPercent,
		int xOffset, int yOffset,
		ctlColor triangleFillColor32,		//这个值是 32 位的颜色，用于填充背景
		ctlColor triangleBorderColor32,		//这个值是 32 位的颜色，用于绘制边框
		bool sizeIsAbsolute = false,
		ctlRoot::moveAlignment alignment = ctlRoot::moveAlignment::leftTop,
		decltype(ctlNotifyUserDraw::state) state = ctlNotifyUserDraw::background);

	ctlRoot::lamNotifyEvent createTriangleButtonHandle(
		ctlTriangleDirection direction,		//决定三角形指向的方向
		float widthPercent, float heightPercent,
		int xOffset, int yOffset,
		ctlColor triangleFillColor32,		//这个值是 32 位的颜色，用于填充背景
		bool sizeIsAbsolute = false,
		ctlRoot::moveAlignment alignment = ctlRoot::moveAlignment::leftTop,
		decltype(ctlNotifyUserDraw::state) state = ctlNotifyUserDraw::background);

	/* 限制可以插入的文字
	 * 可用事件 ctlNotifyEventType::edit */
	ctlRoot::lamNotifyEvent createEditInsertLimitHandle(
		const ctlText& limitText,
		bool limitWay = true,		//如果为 true，则允许的字符为 limitText，否则不允许的字符为 limitText
		bool copyBehavior = true);	//如果为 true，则粘贴时剔除不允许的字符，粘贴允许字符，否则若有不允许字符则不粘贴

	/* 添加鼠标悬停时设置字体样式的处理器 */
	void addMouseStayFontStyle(
		IFont* object,
		unsigned enterIndex);		//鼠标进入的是样式（字体队列的标号）
}

#endif